package servlet;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "Servlet17", value = "/mother")
public class Servlet17 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //getParameter方法，仅适用于:客户端给服务器传参数
        String money = request.getParameter("money");//10000
        String nn = (String) request.getAttribute("nn");//12000
        System.out.println("(妈妈)孩子本次需要:"+money+"元");
        System.out.println("(妈妈)爸爸多给钱:"+nn+"元");
        Double nnn = Double.valueOf(nn);
        Double nnnn=nnn +5000;
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out = response.getWriter();
        out.write("孩子得到金额是:"+nnnn);

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
